package com.lifeng.patterns.strategy;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * Created by lifeng on 2019/8/15.
 */
@Service
public class OldPayTypeSelect {
    @Resource
    private WeChatPayService weChatPayService;
    @Resource
    private AliPayService aliPayService;
    /**
     * 支付方式选择
     * */
    public PayType select(String payTypeFlag){
        if("ali".equals(payTypeFlag)){
            return weChatPayService;
        }else if("wechat".equals(payTypeFlag)){
            return aliPayService;
        }else{
            throw new RuntimeException("找不到"+payTypeFlag+"此支付方式");
        }
    }
}
